﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WordNet.Core.ElementContracts;

namespace WordNet.Core
{
    public class ExceptionEntry:ExceptionEntryProxy, IExceptionEntry
    {
        private readonly POS _pos;
        private readonly IExceptionEntryID _id;

        public ExceptionEntry(IExceptionEntryProxy proxy, POS pos)
            : base(proxy)
        {
            if (pos == null)
                throw new ArgumentNullException();
            _pos = pos;
            _id = new ExceptionEntryID(SurfaceForm, pos);
        }

        public ExceptionEntry(String surfaceForm, POS pos, params String[] rootForms)
            : base(surfaceForm, rootForms)
        {

            if (pos == null)
                throw new ArgumentNullException();
            _id = new ExceptionEntryID(SurfaceForm, pos);
            _pos = pos;
        }

        public override string ToString()
        {
            return String.Format("{0}-{1}", base.ToString(), _pos.ToString()) ;
        }

        public POS PartOfSpeech
        {
            get { return _pos; }
        }

        public IExceptionEntryID ID
        {
            get { return _id; }
        }
    }
}
